home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / TransSkel 3.24 / Source / Positioning Stuff / SkelTestRectVis.c < prev   
Text File  |  1996-01-17  |  917b  |  38 lines

  1. /*
  2.  * SkelTestRectVisible ()
  3.  *
  4.  * Test whether or not the given rectangle is completely visible on the
  5.  * desktop.  Done by converting the rectangle to a region, intersecting
  6.  * it with the desktop region, and checking whether or not the intersection
  7.  * is the same as the rectangle's region.
  8.  *
  9.  * Result is false if the regions needed for the calculation can't be
  10.  * allocated.
  11.  */
  12.  
  13. # include    "TransSkel.h"
  14.  
  15.  
  16. pascal Boolean
  17. SkelTestRectVisible (Rect *r)
  18. {
  19. Boolean        result = false;
  20. RgnHandle    rectRgn;
  21. RgnHandle    rgn;
  22.  
  23.     rectRgn = NewRgn ();
  24.     if (rectRgn != (RgnHandle) nil)
  25.     {
  26.         rgn = (RgnHandle) SkelQuery (skelQGrayRgn);
  27.         if (rgn != (RgnHandle) nil)
  28.         {
  29.             RectRgn (rectRgn, r);                /* convert rect to region */
  30.             SectRgn (rectRgn, rgn, rgn);        /* intersect with desktop */
  31.             result = EqualRgn (rectRgn, rgn);    /* true if completely within */
  32.             DisposeRgn (rgn);
  33.         }
  34.         DisposeRgn (rectRgn);
  35.     }
  36.     return (result);
  37. }
  38.